+2005-02-08 Matthias Clasen <mclasen@redhat.com>
+
+ * gtk/gtkuimanager.c (start_element_handler): Accept
+ the "expand" attribute and set a flag in the node if it
+ is set to "true".
+ (update_node): If the expand flag is set, make separator
+ toolitems non-drawn and expanding. (#166489, Christian Persch)
+
+
2005-02-05 Hans Breuer <hans@breuer.org>
* gdk/makefile.msc gdk/win32/makefile.msc gtk/makefile.msc.in :
+2005-02-08 Matthias Clasen <mclasen@redhat.com>
+
+ * gtk/gtkuimanager.c (start_element_handler): Accept
+ the "expand" attribute and set a flag in the node if it
+ is set to "true".
+ (update_node): If the expand flag is set, make separator
+ toolitems non-drawn and expanding. (#166489, Christian Persch)
+
+
2005-02-05 Hans Breuer <hans@breuer.org>
* gdk/makefile.msc gdk/win32/makefile.msc gtk/makefile.msc.in :
+2005-02-08 Matthias Clasen <mclasen@redhat.com>
+
+ * gtk/gtkuimanager.c (start_element_handler): Accept
+ the "expand" attribute and set a flag in the node if it
+ is set to "true".
+ (update_node): If the expand flag is set, make separator
+ toolitems non-drawn and expanding. (#166489, Christian Persch)
+
+
2005-02-05 Hans Breuer <hans@breuer.org>
* gdk/makefile.msc gdk/win32/makefile.msc gtk/makefile.msc.in :
+2005-02-08 Matthias Clasen <mclasen@redhat.com>
+
+ * gtk/tmpl/gtkuimanager.sgml: Mention the expanding
+ toolbar separators.
+
2005-02-03 Matthias Clasen <mclasen@redhat.com>
* gtk/gtk-sections.txt: Add gtk_stock_set_translate_func.
<!ELEMENT toolitem EMPTY >
<!ELEMENT separator EMPTY >
<!ELEMENT accelerator EMPTY >
-<!ATTLIST menubar name #IMPLIED
- action #IMPLIED >
-<!ATTLIST toolbar name #IMPLIED
- action #IMPLIED >
-<!ATTLIST popup name #IMPLIED
- action #IMPLIED >
-<!ATTLIST placeholder name #IMPLIED
- action #IMPLIED >
-<!ATTLIST separator name #IMPLIED
- action #IMPLIED >
-<!ATTLIST menu name #IMPLIED
- action #REQUIRED
- position (top|bot) #IMPLIED >
-<!ATTLIST menuitem name #IMPLIED
- action #REQUIRED
- position (top|bot) #IMPLIED >
-<!ATTLIST toolitem name #IMPLIED
- action #REQUIRED
- position (top|bot) #IMPLIED >
-<!ATTLIST accelerator name #IMPLIED
- action #REQUIRED >
+<!ATTLIST menubar name #IMPLIED
+ action #IMPLIED >
+<!ATTLIST toolbar name #IMPLIED
+ action #IMPLIED >
+<!ATTLIST popup name #IMPLIED
+ action #IMPLIED >
+<!ATTLIST placeholder name #IMPLIED
+ action #IMPLIED >
+<!ATTLIST separator name #IMPLIED
+ action #IMPLIED
+ expand (true|false) #IMPLIED >
+<!ATTLIST menu name #IMPLIED
+ action #REQUIRED
+ position (top|bot) #IMPLIED >
+<!ATTLIST menuitem name #IMPLIED
+ action #REQUIRED
+ position (top|bot) #IMPLIED >
+<!ATTLIST toolitem name #IMPLIED
+ action #REQUIRED
+ position (top|bot) #IMPLIED >
+<!ATTLIST accelerator name #IMPLIED
+ action #REQUIRED >
</programlisting>
There are some additional restrictions beyond those specified in the
DTD, e.g. every toolitem must have a toolbar in its anchestry and
can make it hard or impossible to determine in advance whether a separator
will end up in such an unfortunate position.
</para>
+
+<para>
+For separators in toolbars, you can set <literal>expand="true"</literal> to
+turn them from a small, visible separator to an expanding, invisible one.
+Toolitems following an expanding separator are effectively right-aligned.
+</para>
</refsect2>
<refsect2>
<title>Empty Menus</title>
GList *uifiles;
guint dirty : 1;
+ guint expand : 1; /* used for separators */
};
#define GTK_UI_MANAGER_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), GTK_TYPE_UI_MANAGER, GtkUIManagerPrivate))
const gchar *action;
GQuark action_quark;
gboolean top;
+ gboolean expand;
gboolean raise_error = TRUE;
{
top = !strcmp (attribute_values[i], "top");
}
+ else if (!strcmp (attribute_names[i], "expand"))
+ {
+ expand = !strcmp (attribute_values[i], "true");
+ }
else
{
gint line_number, char_number;
NODE_TYPE_SEPARATOR,
TRUE, top);
+ NODE_INFO (node)->expand = expand;
+
if (NODE_INFO (node)->action_name == 0)
NODE_INFO (node)->action_name = action_quark;
{
GtkWidget *toolbar;
gint pos;
+ gint separator_mode;
if (GTK_IS_SEPARATOR_TOOL_ITEM (info->proxy))
{
g_object_ref (info->proxy);
gtk_object_sink (GTK_OBJECT (info->proxy));
gtk_widget_set_no_show_all (info->proxy, TRUE);
+ if (info->expand)
+ {
+ gtk_tool_item_set_expand (GTK_TOOL_ITEM (item), TRUE);
+ gtk_separator_tool_item_set_draw (item, FALSE);
+ separator_mode = SEPARATOR_MODE_VISIBLE;
+ }
+ else
+ separator_mode = SEPARATOR_MODE_SMART;
+
g_object_set_data (G_OBJECT (info->proxy),
"gtk-separator-mode",
- GINT_TO_POINTER (SEPARATOR_MODE_SMART));
+ GINT_TO_POINTER (separator_mode));
gtk_widget_show (info->proxy);
}
}